local sk__fuzhi = fk.CreateSkill {

  name = "sk__fuzhi",

  tags = { Skill.Wake, },

}



sk__fuzhi:addEffect(fk.EventPhaseStart, {
  name = "sk__fuzhi",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__fuzhi.name) and
      player:usedSkillTimes(sk__fuzhi.name, Player.HistoryGame) == 0 and
      player.phase == Player.Start
  end,
  can_wake = function(self, event, target, player, data)
    return player.hp == 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:changeMaxHp(player, 1)
    if player.dead then return end
    if player:isWounded() then
      room:recover({
        who = player,
        num = 1,
        recoverBy = player,
        skillName = sk__fuzhi.name,
      })
    end
    if player.dead then return end
    local skills = {}
    for _, s in ipairs(player.player_skills) do
      if s:isPlayerSkill(player) and s.visible then
        table.insert(skills, "-"..s.name)
      end
    end
    room:handleAddLoseSkills(player, table.concat(skills, "|").."|sk__yaozhi|sk__xingyun", nil, true, false)
  end,
})

return sk__fuzhi